package flymoke.generic.method;

import flymoke.generic.inter.Generator;

public class BaseGeneric<T> implements Generator<T>{
	private Class<T> type;
	
	public BaseGeneric(Class<T> type){
		this.type =  type;
	}
	
	@Override
	public T next() {
		try {
			return type.newInstance();
		} catch (Exception e) {
			throw new RuntimeException();
		} 
	}

	public static <T> BaseGeneric<T>  create(Class<T> type){
		return new BaseGeneric<T>(type);
	}
}
